package com.huawei.cloud.phone.management.adapter.phone;

import com.huawei.cloud.phone.management.domain.phone.PhoneDomainService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@AllArgsConstructor
@Component
public class PhoneResourceSync {
    private final PhoneDomainService phoneDomainService;

    /**
     * 定时同步手机可用状态，每1分钟同步一次
     */
    @Scheduled(fixedDelay = 60 * 1000)
    public void syncPhoneUseStatus() {
        log.info("sync phone use status.");
        phoneDomainService.syncPhoneUseStatus(120);
    }
}
